package com.mspbots.web.reports;


import com.fasterxml.jackson.databind.JsonNode;
import com.mspbots.web.reports.service.HealthReportService;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.util.Map;

@Log4j2
@RestController
@RequestMapping("health")
@RequiredArgsConstructor
public class HealthReportController {


    private final HealthReportService healthReportService;

    @GetMapping(path = "/list-tenant")
    public Mono<JsonNode> listTenant(@RequestParam Map<String, Object> queryParams) {
        return healthReportService.listTenant(queryParams);
    }

    @GetMapping(path = "/queryTenantAuthority")
    public Flux<JsonNode> queryTenantAuthority(@RequestParam Map<String, Object> queryParams) {
        return healthReportService.selectTenantAuthority(queryParams);
    }

    @GetMapping(path = "/queryTenantHealth")
    public Mono<JsonNode> queryTenantHealth(@RequestParam Map<String, Object> queryParams) {
        return healthReportService.queryTenantHealth(queryParams);
    }

}
